Repository navigation
Conversation
执行机器在任何进程启动之前就可能失败(CLI 未安装、模型未指定、凭据不可用)。 这些 pre-flight 错误一律上报 exitCode=0,控制面拼成「Pi 需要指定模型 (exit 0)」, 看日志的人会去找一个根本不存在的崩溃进程。 - execResult 增加 ran:只有真正 spawn 出进程(或 docker exec 成功执行)才置位。 - 新增 processRan(err):nil 或 *exec.ExitError 才算跑过,exec 找不到 / 权限不足 / 启动中断都不算。 - daemon 里抽出 reportedExitCode:成功照旧上报;失败只在 ran 时上报,pre-flight 失败不再带退出码。 - 新增测试覆盖三种情形。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
现象
执行机器在任何进程启动之前就会失败的一类错误,被上报成
exitCode: 0,控制面再拼成:前一句尤其误导:它把"角色没配模型"写成了"进程跑完退出码 0",看日志的人会去找一个根本不存在的崩溃进程。
根因
execResult.exitCode是零值0,而daemon.go对 failed/success 一律上报:预检失败的
execResult只填了status+errMsg(例如BindAgentCLICommand返回"Pi 需要指定模型"、镜像里没有 CLI),从未有过进程,exitCode自然还是 0。控制面runner_dispatch.go只要看到ExitCode != nil就追加(exit N)。改动
execResult增加ran,只在真正 spawn 之后置位(executeProcess/executeSandboxProcess的终态分支)。processRan(err):nil(正常退出)或*exec.ExitError(非零退出)才算跑过;exec: "pi": executable file not found、权限不足、启动中断都不算。daemon.go抽出reportedExitCode(result):成功照旧上报(行为不变);失败只在ran时上报。于是上面那句变成干净的Pi 需要指定模型,而真正崩过的进程仍然带(exit 127)。internal/runner/exit_code_report_test.go:cover pre-flight 失败(无退出码)、executor 崩了(127)、成功(0)、以及processRan对 spawn 失败/非零退出的判定。验证
GOOS=linux go build ./internal/runner/、go vet通过(仓库只支持 unix,Windows 上的syscall报错是既有问题)。TestExecuteProcessAndSandboxOutcomes、TestExecuteProcessCancellationReapsPromptly、TestExecuteWorkBranchPushAndPull、TestExecuteBuiltinInvocation等 PASS;TestWorkflowAgentNodeDispatchesToRunner、TestRunnerBoundRoleRunsGatesOnRunnerMachine两个用例在这个容器里超时,但在未改动的 origin/main 上是同样的超时,属该环境的既有失败(缺少 gate/agentflow 二进制相关依赖),与本改动无关。相关的另一个问题(本 PR 不处理)
同一个 run 里还遇到过:
run_artifacts.content是 TEXT(64 KB),产物一大就写库失败、且节点终态写入失败被静默吞掉,run 永久停在running。那个问题单独提了 PR #992。